<template>
  <div class="detail">
    <div class="charts">
      <el-button type="primary" plain @click="gocolumn">柱状图</el-button>
      <el-button type="primary" plain @click="gosector">扇形图</el-button>
      <el-button type="primary" @click="hide">隐藏图表</el-button>
    </div>
    <column v-show="iscolumn" :datalist="datalist"></column>
    <sector v-show="issector"></sector>
  </div>
</template>

<script>
import column from '@/components/Analysis/charts/column'
import sector from '@/components/Analysis/charts/sector'
// import axios from 'axios'
export default {
  data(){
    return{
      datalist:{"A":1,"B":2,"C":3,"D":4},
      "iscolumn":false,
      "issector":false
    }
  },
  components:{
    column,
    sector
  },
  methods:{
    gocolumn(){
      if(this.$data.iscolumn===false){
        this.$data.iscolumn=true
        this.$data.issector=false
      }
    },
    gosector(){
      if(this.$data.issector===false){
        this.$data.iscolumn=false
        this.$data.issector=true
      }
    },
    hide(){
      this.$data.iscolumn=false
      this.$data.issector=false
  }
  // created(){
  //   axios.post('/api/v1/products/search/', {'id': this.id})
  //   .then(res=>{
  //     if(res.data.code===200){

  //     }
  //   })
  // }
  }
}
</script>
<style>
  
</style>
